package tdd.performancebill.infrastructure.persistence;

import org.springframework.stereotype.Repository;
import tdd.performancebill.domain.play.Play;
import tdd.performancebill.domain.play.PlayRepository;

import java.util.HashMap;
import java.util.Map;

@Repository
public class PlayRepositoryMem implements PlayRepository {
    private Map<String, Play> plays = new HashMap<>();

    public PlayRepositoryMem() {
        //初始化戏剧列表
        plays.put("hamlet", new Play("hamlet", "Hamlet", "tragedy"));
        plays.put("as-like", new Play("as-like", "As You Like It", "comedy"));
        plays.put("othello", new Play("othello", "Othello", "tragedy"));
    }

    @Override
    public Play findById(String playId) {
        return plays.get(playId);
    }
}
